<%@page import="dao.AddressDao"%>
<%@page import="entity.Address"%>
<%@page import="java.util.List"%>
<%@page import="entity.Member"%>
<%@page import="dao.MemberDao"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page errorPage="error.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" charset="utf-8" />
    </head>
    <body>
        <div  class="container">
                <%
                    String name=(String)session.getAttribute("username");
                    Member member=new MemberDao().getMemberByName(name);
                    List<Address> list=new AddressDao().getAllUndeletedAddress(member.getId());
                %>
                <h1 class="text-primary text-center">管理收货地址</h1>
                <div style="position: absolute;right:500px"><a href="Member.jsp?name=<%=name%>">返回个人主页</a></div>
                <br>
                <h3><a href="AddAddress.jsp?name=<%=name%>">添加收货地址</a></h3>
                <%
                    for(int i=0;i<list.size();i++){
                %>
                <div>
                    <h3>地址<%=i+1%></h3>
                    <p>详细地址：<%=list.get(i).getAddress()%></p>
                    <p>收件人：<%=list.get(i).getAddressee()%></p>
                    <p>电话：<%=list.get(i).getPhone()%></p>
                    <p>邮编：<%=list.get(i).getZipcode()%></p>
                    <p style="font-size: 15px"><a href="das?id=<%=list.get(i).getId()%>&name=<%=name%>">删除地址</a></p>
                </div><br>
                <%
                    }
                %>
                
        </div> 
                
    </body>
</html>
